const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const autoprefixer = require('autoprefixer');
const baseWebpackConfig = require('./webpack.config.base');
const {environment, project, version} = require('../build/project');
const  package = require('../../package.json');
function resolve(dir) {
    return path.join(__dirname, '..', dir);
}

module.exports = merge(baseWebpackConfig, {
    devtool: '#cheap-module-eval-source-map',
    entry: {
        index: [

        ]
    },
    plugins: [
        new webpack.ContextReplacementPlugin(
            /angular(\\|\/)core(\\|\/)@angular/,
            resolve('../src/projects/' + project + '/app')
        ),
        new webpack.optimize.OccurrenceOrderPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoEmitOnErrorsPlugin(),
    ],
    output:{
        publicPath: '/',
        path: resolve('../dist/' + project + '/' + package.version),
        filename: 'static/[name].js?ver=[hash]',
        chunkFilename: 'static/routes/[name].chunk.js?version=[hash]', // 按需加载输出的文件名
    }
});
